<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<fmt:setBundle basename="infomessages" var="info"/>
<%
	request.setAttribute("path", request.getContextPath());
%>
<script type="text/javascript">
$(function(){
	validateInfo();
});

function validateInfo(){
	
	$("#password").change(function (){
		check.password("password");
	});
	
	$("#newPassword").change(function (){
		check.password("newPassword");
		var val = $.trim($("#surePassword").val())
		if(!common.isEmpty(val)){ 
			check.surePassword("surePassword","newPassword","password");
		}
	});
	
	$("#surePassword").change(function (){
		check.surePassword("surePassword","newPassword","password");
	});
	

}
function saveUser(){
	if((check.emptyCheck("password") && check.password("password")) & (check.emptyCheck("password") && check.password("newPassword")) & check.surePassword("surePassword","newPassword","password")){
		var uri = "${root}/app/user/modify/password";
		common.ajaxSubmit(uri,"userForm","修改密码失败","修改密码成功","chgSucc()");
	}
}
function chgSucc(){
	common.reload('${root}/app/user/setting/${userMe.id}?h=h01&n=n04');
}
</script>
<form class="form-horizontal" id="userForm" role="form">
	<jsp:include page="../../base/token.jsp" />
	<div class="control-group">
	    <label class="control-label">请输入原密码:</label>
	    <div class="controls">
	      &nbsp;<input type="password" class="input-xlarge" name="password" id="password" maxlength="20"  >
	    </div>
  	</div>
	<div class="control-group">
	    <label class="control-label">请输入原密码:</label>
	    <div class="controls">
	      &nbsp;<input type="password" class="input-xlarge" name="newPassword" id="newPassword" maxlength="20"  >
	    </div>
  	</div>
	<div class="control-group">
	    <label class="control-label">请输入确认密码:</label>
	    <div class="controls">
	     &nbsp;<input type="password" class="input-xlarge" name="surePassword" id="surePassword" maxlength="20"  >
	    </div>
  	</div>
	<div class="form-actions text-center">
      <button type="button" class="btn btn-success" onclick="saveUser()">保存</button>
  </div>
</form>

